package com.yeepay.power.controller;

import com.alibaba.fastjson.JSON;
import com.yeepay.power.dao.UserEntityMapper;
import com.yeepay.power.entity.UserEntity;
import com.yeepay.power.entity.UserEntityExample;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;


@Controller
@RequestMapping("/app")
public class HomeController {

    private Logger LOGGER= LoggerFactory.getLogger(HomeController.class);


    @Autowired
    UserEntityMapper userEntityMapper;


    @RequestMapping("/test")
    public ModelAndView toEdit(Long id) {
        LOGGER.info("调用测试controller");
        UserEntityExample userEntityExample = new UserEntityExample();
        userEntityExample.createCriteria().andIdIsNotNull();
        List<UserEntity> userEntities = userEntityMapper.selectByExample(userEntityExample);
        LOGGER.info("测试用户数据{}", JSON.toJSONString(userEntities));

        ModelAndView mav = new ModelAndView();
        mav.setViewName("demo");
        return mav;
    }

}
